<?php
/**
 * Created by PhpStorm.
 * User: 27642
 * Date: 2017/12/24
 * Time: 18:45
 */
namespace app\api\model;

class ProductModel extends BaseModel
{
    protected $table = 'os_product';

    /**
     * 根据产品栏目id获取产品列表`
     * @param $cid
     * @return false|\PDOStatement|string|\think\Collection
     */
    public function getListByCid($cid)
    {
        return $this->where(['status' =>1,'cid' => $cid])->field('content', true)->cache(true)->order('sort ASC')->select();

    }

    /**
     * 获取产品详情
     * @param $id
     * @return array|false|\PDOStatement|string|\think\Model
     */
    public function getDetailById($id)
    {
         return $this->where(['id' => $id])->cache(true)->find();
    }
}